<!DOCTYPE html >
<html>
<head>
    <link rel="stylesheet" href="demos.css" type="text/css" media="screen" />
    
    <script src="../libraries/RGraph.common.core.js" ></script>
    <script src="../libraries/RGraph.common.dynamic.js" ></script>
    <script src="../libraries/RGraph.common.tooltips.js" ></script>
    <script src="../libraries/RGraph.drawing.rect.js" ></script>
    <script src="../libraries/RGraph.line.js" ></script>
    <!--[if lt IE 9]><script src="../excanvas/excanvas.js"></script><![endif]-->
    
    <title>A demo of a logarithmic chart</title>
    
    <meta name="description" content="A Line chart using specific labels to give a logarithmic axis" />
</head>
<body>

    <h1>A demo of a logarithmic chart</h1>
    
    <p>
        This demonstrates a logarithmic chart using log(10). It has custom Y labels.
    </p>

    <canvas id="cvs" width="600" height="300">[No canvas support]</canvas>
    
    <script>
        window.onload = function ()
        {
            var data = [999999,5,6,4,6,8012,12,7];
            
            for (var i=0;i<data.length; ++i) {
                data[i] = log10(data[i]);
            }


            function log10(val)
            {
                return Math.log(val) / Math.log(10);
            }


            var line = new RGraph.Line('cvs', data);
            line.Set('chart.numyticks', 6);
            line.Set('chart.ymax', 6);
            line.Set('chart.ylabels.specific', [
                                                RGraph.number_format(line, 1000000),
                                                RGraph.number_format(line, 100000),
                                                RGraph.number_format(line, 10000),
                                                RGraph.number_format(line, 1000),
                                                100, // No need to format this
                                                10,   // No need to format this
                                                ''
                                               ]);
            line.Set('chart.gutter.left', 65);
            line.Set('chart.labels', ['Pob','Libby','June','Hoolio','Jane','Daz','Luis','John']);
            line.Set('chart.background.grid.autofit.numhlines', 6);
            line.Set('chart.background.grid.autofit.numvlines', 7);
            line.Set('chart.numxticks', 7);
            line.Draw();
        }
    </script>

    <p>
        <a href="./">&laquo; Back</a>
    </p>

</body>
</html>